-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add periodic refresh #1855
Add periodic refresh #1855
Conversation
@@ -680,7 +680,8 @@ public NavigationRoute build() { | |||
.voiceInstructions(true) | |||
.bannerInstructions(true) | |||
.roundaboutExits(true) | |||
.eventListener(eventListener); | |||
.eventListener(eventListener) | |||
.enableRefresh(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling refresh by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Guardiola31337 this is looking great, let's add the options you have marked in the TODOs and 🚢
4c5b556
to
b322c74
Compare
Remaining TODOs were addressed and this is updated and ready for a final round of 👀 |
Codecov Report
@@ Coverage Diff @@
## master #1855 +/- ##
============================================
+ Coverage 33.59% 33.83% +0.23%
- Complexity 1015 1026 +11
============================================
Files 254 256 +2
Lines 8701 8746 +45
Branches 660 662 +2
============================================
+ Hits 2923 2959 +36
- Misses 5518 5525 +7
- Partials 260 262 +2 |
…c and etas on a regular basis when in navigation
b322c74
to
c312f28
Compare
…c and etas on a regular basis when in navigation (#1855)
…c and etas on a regular basis when in navigation (#1855)
…c and etas on a regular basis when in navigation (#1855)
Description
Adds periodic refresh functionality
What's the goal?
Add a polling mechanism to refresh traffic and ETAs on a regular basis (5 minutes) when in navigation
How is it being implemented?
RouteRefresher
includes acheck
method which 👀 if the refresh interval has been met. This is checked withinRouteProcessorRunnable
and iftrue
,RouteRefresher#refresh
is called which callsRouteRefresh#refresh
and updates a flag to preventrefresh
from being called multiple times until the route response is received. At this point, the refreshed route is passed in viamapboxNavigation.startNavigation(directionsRoute, DirectionsRouteType.FRESH_ROUTE);
which updates traffic and ETAs data. Finally, everything is reset in preparation for the next interval check.TODOs
MapboxNavigationOptions
to enable / disable refresh route (enabled by default every 5 minutes) and remove hardcoded default intervalmapbox-navigation-android/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java
Line 935 in 4c5b556
MapboxNavigationOptions
to customize the refresh interval (defaulted to 5 minutes)How has this been tested?
Checklist
SNAPSHOT
upstream dependencies if needed)